<?php
include('config.php');
include('fonctions.php');
/* RECEIVE VALUE */
$validateValue = htmlspecialchars(trim($_REQUEST['fieldValue']));
$validateId = $_REQUEST['fieldId'];

/* RETURN VALUE */
$arrayToJs = array();
$arrayToJs[0] = $validateId;

$connection = connexionBdd();
$req = $connection->prepare('SELECT `membre_mail` FROM `membres` WHERE `membre_mail`= :mail');
$req->bindParam(':mail', $validateValue, PDO::PARAM_STR);
$req->execute();
$count = $req->rowCount();
$req -> closeCursor();
if ($count > 0) {
    $arrayToJs[1] = false;    
} else {
    $arrayToJs[1] = true;    
}
echo json_encode($arrayToJs);
?>